<?php

use App\Api\AuthController;
use App\Api\PositionController;
use App\Api\UploadController;
use App\Api\UserController;
use App\Api\AttachmentController;
use Illuminate\Support\Facades\Route;

Route::post('auth/login', [AuthController::class, 'login']);
Route::group(['middleware' => ['auth:sanctum']], function () {
    Route::post("user/logout", [AuthController::class, 'logout']);
    Route::get("user/current", [UserController::class, 'current']);
    Route::put("user/password", [UserController::class, 'updatePassword']);
    Route::get("user/{user}/resetPassword", [UserController::class, 'resetPassword']);

    Route::get("user/records", [UserController::class, "records"]);
//    用户管理
    Route::apiResource("user", UserController::class);
    Route::apiResource("position", PositionController::class);

    //    图片上传
    Route::post('upload', [UploadController::class, 'upload']);

    Route::get("bg/img",[AttachmentController::class,'latestImg']);
});
